﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using D3DSS.IDomain;
using D3DSS.DataContract;

namespace D3DSS.Service
{
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]

    public class DropStatisticsService
    {
        /// <summary>
        /// 泛型领域服务
        /// </summary>
        protected IDropStatistics DropStatistics { get; set; }

        public DropStatisticsService(IDropStatistics dropStatistics)
        {
            DropStatistics = dropStatistics;
        }

        /// <summary>
        /// 创建统计单
        /// </summary>
        /// <returns></returns>
        [WebInvoke(UriTemplate = "CreateStatisticsOrder", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        public Response<StatisticsOrderResponse> CreateStatisticsOrder(StatisticsOrderRequest request)
        {
            return DropStatistics.CreateStatisticsOrder(request);
        }

        /// <summary>
        /// 创建掉落统计项
        /// </summary>
        /// <returns></returns>
        [WebInvoke(UriTemplate = "CreateDrop", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        public Response<DropResponse> CreateDrop(DropRequest request)
        {
            return DropStatistics.CreateDrop(request);
        }

        /// <summary>
        /// 查询统计
        /// </summary>
        /// <returns></returns>
        [WebInvoke(UriTemplate = "QueryStatistics", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
        public Response<QueryStatisticsResponse> QueryStatistics(QueryStatisticsRequest request)
        {
            return DropStatistics.QueryStatistics(request);
        }
    }
}
